package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.query.AdminNotePageQuery;
import com.tianji.learning.domain.vo.AdminNoteDetailVO;
import com.tianji.learning.domain.vo.AdminNoteVO;
import com.tianji.learning.service.INoteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 笔记表 前端控制器
 * </p>
 *
 * @author author
 * @since 2025-04-25
 */
@RestController
@RequestMapping("/admin/notes")
@Api(tags = "笔记表接口-管理端")
@RequiredArgsConstructor
public class AdminNoteController {
    private final INoteService noteService;


    @GetMapping("/page")
    @ApiOperation("分页查询笔记-管理端")
    public PageDTO<AdminNoteVO> queryNoteToAdmin(AdminNotePageQuery query){
        return noteService.queryAdminNote(query);
    }
    @GetMapping("/{id}")
    @ApiOperation("根据id查询笔记详情-管理端")
    public AdminNoteDetailVO queryNoteDetailToAdmin(@PathVariable("id") Long id){
        return noteService.queryNoteDetailToAdmin(id);
    }
    @PutMapping("/{id}/hidden/{hidden}")
    @ApiOperation("隐藏或显示笔记")
    public void hiddenOrShowNote(@PathVariable("id") Long id, @PathVariable("hidden") Integer hidden){
        noteService.hiddenOrShowNote(id, hidden);
    }

}
